package edu.uclmgmu.bacteriosec.domain;

import java.util.Vector;

public class FiltroGenerico {
	private Vector<String> files;
	private String originalPath;
	private String extension;

	public Vector<String> loadFiles(String path, String extension) {
		this.files=new Vector<String>();
		this.extension=extension;
		this.originalPath=path;
		this.load(path, files);
		return this.files;
	}
	
	private void load(String path, Vector<String> files) {
		String[] auxi=new java.io.File(path).list();
		for (String s : auxi) {
			if (this.extension==null || s.endsWith(this.extension)) {
				this.files.add(path + (path.endsWith("/") ? "" : "/") + s);
			} else if ((new java.io.File(path + "/" + s)).isDirectory()) {
				load(path + "/" + s, this.files);
			}
		}
	}

}
